package client;

import com.example.loginvoice_android.MainActivity;
import com.example.loginvoice_android.R;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;

public class RetreiveTask extends AsyncTask<String, Integer, Integer> {

    private Exception exception;
    private int result;
    private Context con;
    private Client_login cn;
    
    public RetreiveTask(Context cn) {
    	super();
    	this.con = cn;
    }
    
    protected void Test(String name, String IP, String official_path) {
    	try {
        	System.out.println("test1");
    		Client_login cn = new Client_login();
    		System.out.println("test new object2");
    		//cn.login("192.168.0.1");
    		System.out.println("test fin object3");
        } catch (Exception e) {
            this.exception = e;
        }	
    }

    @Override
    protected void onPreExecute() {
		super.onPreExecute();
		System.out.println("Begin execution thread");
	}
    
	@Override
	protected Integer doInBackground(String... arg0) {
		System.out.println("test");
		cn = new Client_login();
		System.out.println("test new object");
		result = cn.login(arg0[0], arg0[1], arg0[2], arg0[3]);
		System.out.println("test fin object");
		return result;
	}

	
	protected void onPostExecute(Integer result) {
		super.onPostExecute(result);
		System.out.println("End execution Thread");
	}
	
	public int getResult() {
		return result;
	}

	public void setResult(int result) {
		this.result = result;
	}
}
